package com.huaxin.device.dto.enums.typehandler;

import com.huaxin.device.dto.enums.ConnectionType;
import com.huaxin.hxenum.base.BaseCodeEnumTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@MappedTypes(ConnectionType.class)
public class ConnectionTypeHandler extends BaseCodeEnumTypeHandler<ConnectionType, String> {

    public ConnectionTypeHandler() {
        super(ConnectionType.class);
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, ConnectionType parameter, JdbcType jdbcType) throws SQLException {
        ps.setString(i, parameter.getCode());
    }
}